<?php

namespace Dcat\Admin\GridCategory;

use Dcat\Admin\Extend\ServiceProvider;
use Dcat\Admin\Admin;
use Dcat\Admin\Layout\Content;
class GridCategoryServiceProvider extends ServiceProvider
{
	protected $js = [
        'js/index.js',
    ];
	protected $css = [
		'css/index.css',
	];

	public function register()
	{

	}
 
	public function init()
	{
		parent::init();
		$this->app->resolving(Content::class, function ($content, $app) {
			//设置view 为 iframe.full-content
			$content->view('chinahacker.grid-category::full-content');
			if(strpos(request()->getUri(),'auth/login') !== false){
				Admin::script(<<<JS
				if (window != top)
					top.location.href = location.href; 
JS
				);
			}
		});
		Content::resolving(function (Content $content) {
			//设置view 为 iframe.full-content
			$content->view('chinahacker.grid-category::full-content');
			if(strpos(request()->getUri(),'auth/login') !== false){
				Admin::script(<<<JS
				if (window != top)
					top.location.href = location.href; 
JS
				);
			}
		});
		//
		
	}

	public function settingForm()
	{
		return new Setting($this);
	}
}
